package com.bwhx.eruler.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.bwhx.eruler.bean.Order;
import com.bwhx.eruler.bean.Page;
import com.bwhx.eruler.dao.OrderDao;

/**
 * @Description:
 */
@Repository
public class OrderDaoImpl extends BaseDaoImpl<Order> implements OrderDao {
	public OrderDaoImpl() {
		this.setNs("com.bwhx.eruler.mapper.OrderMapper.");
	}


	public List<Order> findByName(String ordername) {
	
		return getSqlSession().selectList("com.bwhx.eruler.mapper.OrderMapper." + "findByName", ordername);
	}


	

	@Override
	public void inputOrder(Order d) {
		this.getSqlSession().update("com.bwhx.eruler.mapper.OrderMapper." + "updateruler", d);
		
		
	}

	@Override
	public List<Order> list(Page p) {
		return getSqlSession().selectList("com.bwhx.eruler.mapper.OrderMapper." + "list",p);

	}


	@Override
	public Integer count(Order d) {
		Object selectOne = getSqlSession().selectOne("com.bwhx.eruler.mapper.OrderMapper." + "count",d);
		if(null!=selectOne && selectOne instanceof Integer){
			return (int)selectOne;
		}
		return 0;
	}


	@Override
	public List<Order> orderListAll() {
		return getSqlSession().selectList("com.bwhx.eruler.mapper.OrderMapper." + "listAll");

	}


	@Override
	public void batchInsert(ArrayList<Order> orders) {
		getSqlSession().insert("com.bwhx.eruler.mapper.OrderMapper." + "batchInsert",orders);
		
	}


	@Override
	public void del(String oId) {
		getSqlSession().delete("com.bwhx.eruler.mapper.OrderMapper." + "del",oId);
		
	}
	
}
